package com.reguang.exception;

import com.reguang.enums.HttpStatusEnum;
import com.reguang.enums.ResultCode;

/**
 * 
 * <p>Title: CustomException</p>
 * <p>Description: 自定义异常基类</p>
 * @author weibiao
 * @date 2019年12月24日
 */
public class BaseException extends RuntimeException {

	/** serialVersionUID*/
	private static final long serialVersionUID = 3363010144589610825L;

	private Integer httpStatus = HttpStatusEnum.BAD_REQUEST.code();// 默认500

	private ResultCode resultCode = ResultCode.SERVER_INTERNAL_ERROR;

	public BaseException() {
		super();
	}

	public BaseException(ResultCode resultCode) {
		super(resultCode.message());
		this.resultCode = resultCode;
	}

	public BaseException(Integer httpStatus, ResultCode resultCode) {
		super(resultCode.message());
		this.httpStatus = httpStatus;
		this.resultCode = resultCode;
	}

	public BaseException(Integer httpStatus) {
		this.httpStatus = httpStatus;
	}

	public Integer getHttpStatus() {
		return httpStatus;
	}

	public void setHttpStatus(Integer httpStatus) {
		this.httpStatus = httpStatus;
	}

	public ResultCode getResultCode() {
		return resultCode;
	}

	public void setResultCode(ResultCode resultCode) {
		this.resultCode = resultCode;
	}
}
